#include "StdAfx.h"
#include "ColorData.h"


CColorData::CColorData(void)
{
}


CColorData::~CColorData(void)
{
}

void CColorData::DrawItem( CDC* pDC, const CRect& rc, BOOL bSelected )
{
	CRect rcDraw(rc) ;
	COLORREF	crBackground, crText ;
	if(bSelected)
	{
		crBackground = GetSysColor(COLOR_HIGHLIGHT) ;
		crText = GetSysColor(COLOR_HIGHLIGHTTEXT) ;
	}
	else
	{
		crBackground = GetSysColor(COLOR_WINDOW) ;
		crText = GetSysColor(COLOR_WINDOWTEXT) ;
	}
	pDC->SetBkColor(crBackground) ;
	ExtTextOut(pDC->GetSafeHdc(), 0,0,ETO_OPAQUE, rcDraw, NULL, 0,NULL) ;

	CBrush NewBrush ;
	NewBrush.CreateSolidBrush(m_rgbColor) ;
	CBrush* pOldBrush = pDC->SelectObject(&NewBrush) ;
	pDC->Rectangle(rcDraw.left+2,rcDraw.top+2,rcDraw.left+16,rcDraw.top+16) ;
	pDC->SelectObject(pOldBrush) ;
	rcDraw.left+=16+5 ;

	pDC->SetBkColor(crBackground) ;
	pDC->SetTextColor(crText) ;
	pDC->DrawText(m_strCname, m_strCname.GetLength(), rcDraw, DT_SINGLELINE|DT_VCENTER|DT_LEFT) ;
}
